#include <iostream>
#include <string.h>
using namespace std;
class MyString{
    private:
        char* buffer;
    public:
        MyString(const char* initString){
            buffer=NULL;
            if (initString!=NULL){
                buffer=new char[strlen(initString)+1];
                strcpy(buffer,initString);
            }
        }
        MyString(const MyString& myString){
            buffer=NULL;
            if (myString.buffer!=NULL){
                buffer=new char[strlen(myString.buffer)+1];
                strcpy(buffer,myString.buffer);
            }
        }
        ~MyString(){
            if (buffer!=NULL){
                delete[] buffer;
            }
        }
        int GetLen(){
            if (buffer==NULL) return 0;
            return strlen(buffer);
        }
        char* GetString(){
            return buffer;
        }   
};

void UsingMyString(MyString mystring){
    cout<<"buffer length="<<mystring.GetLen()<<endl;
    cout<<"buffer content="<<mystring.GetString()<<endl;
    return;
}
int main(){
    MyString mystring=MyString("hellow World");
    cout<<"buffer length="<<mystring.GetLen()<<endl;
    cout<<"buffer content="<<mystring.GetString()<<endl;
    UsingMyString(mystring);
    return 0;
}
